﻿using System;
using System.Collections.Generic;
using System.Text;
using Lswweb.Model;
using Lswweb.Domain;

namespace Lswweb.Controls
{
    public class UpFileList : SkinnedGridView<UpFileInfo>
    {
        protected override IList<UpFileInfo> GridViewDataSourceHandler(int pageIndex, int pageSize, out int totalRecord)
        {
            return UpFiles.GetFiles(string.Empty, CategoryId,this.Status,pageIndex, pageSize, out totalRecord);
        }


        private int categoryId = (SiteContext.Current.CategoryId == -1) ? SiteContext.Current.BaseNodeId : SiteContext.Current.CategoryId;
        public int CategoryId
        {
            get { return this.categoryId; }
            set { categoryId = value; }
        }

        public StatusType? Status { get; set; }

        private bool enableDelButton = true;
        public bool EnableDelBtn
        {
            get
            {
                if (SiteContext.Current.EnableDelButton != enableDelButton)
                    enableDelButton = SiteContext.Current.EnableDelButton;

                return enableDelButton;
            }
            set { enableDelButton = value; }
        }


        protected override string DefaultSkinFilename
        {
            get { return "UpFiles/UpFileList.ascx"; }
        }
    }
}
